{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/header.html"}

<!--header stop-->
{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/common/headerusertitle.html"}
<!--header end-->
<!--content stop-->
<section class="box-user">

    <div class="my_tmt">{$orderinfo.cate_name} {$orderinfo.product_name}  {$orderinfo.brand_name} <span class="fr gray">{$orderinfo.update_time}</span></div>

    <div class="my_tms">
        <p class="pt10p">订 单 号：{$orderinfo.order_key}</p>
        <p class="pt10p">状　　态：<span class="orange">{$_SupplyOrderMean[$orderinfo.status]} </span></p>
        <p class="pt10p">配送方式：{if $orderinfo.delivery_method neq ''}{$_orderDeliveryTypeMean[$orderinfo.delivery_method]}{else}自提{/if}</p>

        {if $orderinfo.delivery_method eq '2'}<p class="pt10p">配送地址： {$orderinfo.delivery_addr}</p>{/if}

        {if $orderinfo.status eq $_supplyOrderCfg['audit']}
        <p class="pt10p">单　　价：<input type="text" name="price" value="{$orderinfo.price}" class="my_tms_input"/>元/吨</p>
        <p class="pt10p">数　　量：<input type="text" name="num" value="{$orderinfo.num}" class="my_tms_input"/>吨</p>
        {else}
        <p class="pt10p">单　　价：{$orderinfo.price}元/吨</p>
        <p class="pt10p">数　　量：{$orderinfo.num}吨</p>
        {/if}
    </div>

    <div class="my_tms">
        <h3 class="gray" style="line-height: 35px; font-size: 14px; color: #333; font-weight: bold;">求购公司</h3>
        <p class="w5p">公司名称：<span class="orange">{if $orderinfo.ibusiness_name neq ''}{$orderinfo.ibusiness_name}{/if}</span></p>
        <p class="pt10p">联 系 人 ：{if $orderinfo.icontacts neq ''}{$orderinfo.icontacts}{/if}</p>
        <p class="pt10p">联系电话：{if $orderinfo.imobile neq ''}{$orderinfo.imobile}{/if}</p>
    </div>

    <div class="my_tms">
        <h3 class="gray" style="line-height: 35px; font-size: 14px; color: #333; font-weight: bold;">报价公司</h3>
        <p class="w5p">公司名称：<span class="orange">{if $orderinfo.business_name neq ''}{$orderinfo.business_name}{/if}</span></p>
        <p class="pt10p">联 系 人 ：{if $orderinfo.contacts neq ''}{$orderinfo.contacts}{/if}</p>
        <p class="pt10p">联系电话：{if $orderinfo.mobile neq ''}{$orderinfo.mobile}{/if}</p>
    </div>


    <div class="my_tms">
        <p class="w5p">备注：<span class="orange">{if $orderinfo.remark neq ''}{$orderinfo.remark}{/if} </span></p>
    </div>

    <p class="my_tms_btn">
        {if $orderinfo.status eq $_supplyOrderCfg['audit']}
        <a class="ConfirmOrder" href="javascript:void(0)" vid="{$orderinfo.id}">确认订单</a>
        {/if}

        {if $orderinfo.status eq $_supplyOrderCfg['deal']}
        <a class="upsupply" href="/user/salesorderdone/id/{$orderinfo.id}" >交易完成</a>
        {/if}

        {if $orderinfo.status eq $_supplyOrderCfg['audit'] ||  $orderinfo.status eq $_supplyOrderCfg['deal']}
        <a href="/user/saleordercancel/id/{$orderinfo.id}" style="background: #999;">取消</a>
        {/if}

    </p>

</section>

{literal}
<style>
    .spanmark{
        float: left;
        left: 63px;
        position: absolute;
        top: 14px;
        color: orange;
        z-index: 9999999;
    }
</style>
<script>
    $(function(){
        $(".ConfirmOrder").click(function(){

            var url  = "/user/confirorder";
            var id   = $(this).attr("vid");
            var price= $("input[name=price]").val();
            var num= $("input[name=num]").val();

            $.ajax({
                url:url,
                data:{id:id,price:price,num:num},
                type:'POST',
                success:function(data){
                    var data = eval("("+data+")");
                    var code = data.code;
                    var msg = data.msg;
                    if(code == 8){
                        alert(msg);
                        window.location.reload();
                        return true;
                    }else{
                        alert(msg);
                        return false;
                    }
                },
                dataType:'text'
            });

        });
    })

</script>
{/literal}
{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/footer.html"}
